/*
package com.money.aop;

import io.seata.core.context.RootContext;
import io.seata.core.exception.TransactionException;
import io.seata.tm.api.GlobalTransactionContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;

*/
/**
 *  日志记录aop
 *//*

@Configuration
@Aspect  //切面类
@Slf4j
public class MyAoPConfig {

    @Pointcut("execution(public * com.money.service.impl.*.*(..))")
    public void log() {
    }

    @Around("log()")
    public void around(ProceedingJoinPoint joinPoint) {
        //  System.out.println("前置通知");
        long beginTime = System.currentTimeMillis();
        boolean flag=true;
        try {
            // System.out.println("后值通知");
        } catch (Throwable throwable) {
            flag=false;
            //当我们出现异常通知
            if(!StringUtils.isAllBlank(RootContext.getXID())){
                try {
                    GlobalTransactionContext.reload(RootContext.getXID()).rollback();
                } catch (TransactionException e) {
                    e.printStackTrace();
                }
            }
        }finally {
            if(flag){
                try {
                    GlobalTransactionContext.reload(RootContext.getXID()).commit();
                } catch (TransactionException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
*/
